﻿using AF_Application.Interface.App;
using AF_Application.Interface.Domain;
using AF_Application.Interface.Repertory;
using AF_Application.Interface.Specifications;
using AF_DataModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AF_Application.App
{
    public class AppImpl : IAppImpl
    {
        IDefaultDomain DefaultDomain = null;
        public AppImpl(IDefaultDomain defaultDomain)
        {
            DefaultDomain = defaultDomain;
        }

        public void Dispose()
        {

        }

        //public void Test()
        //{
        //    DefaultDomain.Test();
        //}

        public void AddUSer(T_User User)
        {
            DefaultDomain.Add<T_User>(User);
        }

        public T_User GetUserByOpenID(string OpenID)
        {
            return DefaultDomain.GetOne<T_User>(Specification<T_User>.Eval(s => s.OpenID == OpenID));
        }




        public void UPUser(T_User User)
        {
            DefaultDomain.Update<T_User>(User);
        }


        public void AddAct(T_Act Act)
        {
            DefaultDomain.Add<T_Act>(Act);
        }
    }
}
